<template>
    <Layout class="p-5 bg-white">
        <Form class="p-5"  :label-width="130">
			<Row>
				<Col span="8">
					<FormItem class="w-75" label="押金价格(元):">
						<Input  v-model="amount"/>
					</FormItem>
				</Col>
				</Row>
			<FormItem>
			    <Button @click="submit" type="primary">提交</Button>
			</FormItem>
        </Form>
    </Layout>

</template>
<script>
    export default {
        data() {
            return {
				amount: "",
				data:{amount: ""}
				
            }
        },
        methods: {
            submit: function () {
				if (this.$data.amount != null && this.$data.amount != "" && this.$data.amount > 0) {
					let self = this;
					this.http.put({
					url: "/client/deposit/info",
						param: {
							amount:parseFloat(this.$data.amount*100).toFixed(0)
						}
					}).then(() => {
						this.message.info("修改成功");
					});
				}else{
					this.message.error("价格不能为空且是数字");
					return;
				}
            },
            init: function () {
                this.search();
            },

            search: function () {
                this.http.get({
                    url: "/client/deposit/info",
					param:{
					}
                }).then(data => {
					if(null != data){
						data = data/100
					}
                    this.$data.amount = data;
                });
            }
        },
		
        created: function () {
            this.init();
        }
    }
</script>

<style>
</style>
